class Property < ActiveRecord::Base
  set_table_name :product_properties

  acts_as_list :scope => :property_group_id

  scope :group_by_presentation, :group => "presentation"
  
  belongs_to :property_group, :touch => true

  has_many :property_attributes, :order => :lft, :dependent => :destroy

  validates :presentation, :presence => true, :length => {:maximum => 35}
  validates :property_group_id, :presence => true

  accepts_nested_attributes_for :property_attributes, :allow_destroy => true
end
